package com.pig.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pig.pojo.user.User;
import com.pig.util.SysResultLayui;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper extends BaseMapper<User> {
    /**分页查询用户信息*/
    @Select("select * from p_user order by modifiedTime desc limit #{startIndex},#{limit}")
    List<User> findUserByPage(int startIndex, int limit);
    /**修改密码*/
    @Select("select * from p_user where id=#{id}")
    User findUserById(Integer id);
    @Update("update p-user set password=#{newpass} where id=#{id}")
    void update(Integer id);
    /**添加用户*/
    void insertUser(User user);
    /**查看数据库是否有相同用户名*/
    User findByUserName(String username);
    /**根据用户名查询用户信息
     * @return*/
    @Select("select * from p_user where username=#{username}")
    SysResultLayui findUserByUserName(String username);
    /**根据id改变用户状态*/
    void updateUserStatusById(int id, int status);
}
